package com.heima.feigns;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.WemediaFeignFallback;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojo.WmNews;
import com.heima.model.wemedia.pojo.WmUser;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author by jojo
 * @Date 2022/2/27
 * @Description
 */
@FeignClient(value = "leadnews-wemedia",
        fallbackFactory = WemediaFeignFallback.class)
public interface WemediaFeign {
    /**
     *根据名称查询自媒体用户信息
     * @param name
     * @return
     */
    @GetMapping("/api/v1/user/findByName/{name}")
    public ResponseResult<WmUser> findByName(@PathVariable("name") String name);

    /**
     * 保存自媒体用户信息
     * @param wmUser
     * @return
     */
    @PostMapping("/api/v1/user/save")
    public ResponseResult<WmUser> save(@RequestBody WmUser wmUser);

    /**
     * id查自媒体文章
     * @param id
     * @return
     */
    @GetMapping("/api/v1/news/one/{id}")
    public ResponseResult<WmNews> findWmNewsById(@PathVariable("id") Integer id);

    /**
     * 修改WmNews表的状态
     * @param wmNews
     * @return
     */
    @PutMapping("/api/v1/news/update")
    public ResponseResult updateByStatus(@RequestBody WmNews wmNews);
}
